package com.zksk.admin.api;

import com.zksk.admin.api.factory.RemoteProductFallbackFactory;
import com.zksk.common.core.constant.SecurityConstants;
import com.zksk.common.core.constant.ServiceNameConstants;
import com.zksk.common.core.domain.R;
import com.zksk.mbg.admin.domain.*;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * 后台产品相关模块
 *
 * @author zksk
 */
@FeignClient(contextId = "RemoteProductService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteProductFallbackFactory.class)
public interface RemoteProductService {

    /**
     * 根据发布产品id查看详情
     * @param id
     * @return
     */
    @GetMapping(value = "/productRelease/proReleaseDetails")
    public R<Long> proReleaseDetails(@RequestParam("id") Long id,
                                     @RequestHeader(SecurityConstants.FROM_SOURCE) String source);


    /**
     * 根据客户id获取关联产品列表
     * @param customerId
     * @return
     */
    @GetMapping(value = "/productRelease/getListByCustomerId")
    public R<List<ProductRelease>> getListByCustomerId(@RequestParam("customerId") Long customerId,
                                                       @RequestHeader(SecurityConstants.FROM_SOURCE) String source);


    /**
     * 根据机构产品id获取对应得字段
     * @param orgProductId
     * @return
     */
    @GetMapping(value = "/field/getListByOrgProductId")
    public R<List<FieldSelect>> getListByOrgProductId(@RequestParam("orgProductId") Long orgProductId,
                                             @RequestHeader(SecurityConstants.FROM_SOURCE) String source);


    /**
     * 根据机构id查询机构信息
     * @param orgId
     * @return
     */
    @GetMapping(value = "/org/getOrgById")
    public R<Org> getOrgById(@RequestParam("orgId") Long orgId,
                             @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    /**
     * 根据机构产品id查询详情信息
     * @param orgProductId
     * @return
     */
    @GetMapping(value = "/org/product/getOrgProductById")
    public R<OrgProduct> getOrgProduct(@RequestParam("orgProductId") Long orgProductId,
                                       @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    /**
     * 根据机构产品id获取对应的协议
     * @param orgProductId
     * @return
     */
    @GetMapping("/agreement/getOrgAgreements")
    public R<List<Agreement>> getOrgAgreements(@RequestParam("orgProductId") Long orgProductId,
                                               @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    /**
     * 根据客户所需产品id获取对应的协议
     * @param customerProdReqId
     * @return
     */
    @GetMapping("/agreement/getCustomerAgreements")
    public R<List<Agreement>> getCustomerAgreements(@RequestParam("customerProdReqId") Long customerProdReqId,
                                                    @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

}
